package com.mjlf.mqzook.entity;

import lombok.Data;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

/**
 * @ClassName RegistryServer
 * @Author mjlft
 * @Date 2020/2/18 12:05
 * @Version 1.0
 * @Description 注册服务实例类
 */
@Data
public class RegistryServer {
    @NotNull
    private String name;
    @NotNull
    private String host;
    @NotNull
    private Integer port;
    private Long updateTime;
    private Integer partitionNum = 0;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RegistryServer that = (RegistryServer) o;
        return name.equals(that.name) &&
                host.equals(that.host) &&
                port.equals(that.port);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, host, port);
    }
}
